/*
 * =template=.c
 * Copyright (C) 2019 crane <crane@gosun>
 *
 * Distributed under terms of the MIT license.
 */

#include <iostream>
#include <cstdio>

using namespace std;

int read_n() {
    int n = 0;
    cin >> n;
    return n;
}

int *read_weights(int n) {
    int *weights = (int *)malloc(n * sizeof(int));
    if (weights == NULL) {
        return NULL;
    }

    for (int i = 0; i < n; i++) {
        scanf("%d", weights+i);
    }

    /* for (int i = 0; i < n; i++) { */
    /*     cout << *(weights+i); */
    /* } */

    return weights;
}


int gcd(int max, int min) {
    if (max < min) {
        int swap = max;
        max = min;
        min = swap;
    }

    int remainder = max % min;

    while (remainder != 0) {
        max = min;
        min = remainder;
        remainder = max % min;
    }

    return min;
}

bool run_case() {
    /* cout << gcd(9, 27); */ // 测试功能

    int n = read_n();
    int *weights = read_weights(n);
    if (weights == NULL) {
        return 0;
    }

    if (n == 1 && *weights == 1) {
        return 1;
    }

    auto _gcd = *weights;

    if (_gcd == 1) {
        return 1 ;
    }

    for (int start_idx = 1;  start_idx < n; start_idx++) {
        auto in_num = *(weights + start_idx);
        if (in_num == 1) {
            // 避免进入gcd, 但也可以不需要
            return 1;
        }

        _gcd = gcd(_gcd, in_num);
        if (_gcd == 1) {
            return 1;
        }
    }

    return 0;
}


int main(int argc, char **argv)
{
    int ret = run_case();
    if (ret) {
        cout << "YES";
    } else {
        cout << "NO";
    }
    return 0;
}


